package cn.schoolwow.flow.monitor.entity;

import cn.schoolwow.quickdao.annotation.ColumnType;
import cn.schoolwow.quickdao.annotation.Comment;
import cn.schoolwow.quickdao.annotation.Id;
import cn.schoolwow.quickdao.annotation.TableField;
import com.alibaba.fastjson.JSONObject;

import java.time.LocalDateTime;

@Comment("流程日志")
public class FlowLog {
    @Id
    private long id;

    @Comment("流程id")
    private Long flowId;

    @Comment("流程分类")
    private String categoryName;

    @Comment("流程名称")
    private String name;

    @Comment("请求数据")
    private JSONObject requestData;

    @Comment("上下文执行数据")
    private JSONObject contextData;

    @Comment("流程全局数据")
    private JSONObject quickFlowData;

    @Comment("加载配置数据")
    private JSONObject flowConfigData;

    @Comment("SQL日志")
    @ColumnType("text")
    private String sql;

    @Comment("流程列表")
    @ColumnType("text")
    private String flowNameList;

    @Comment("执行路径")
    @ColumnType("text")
    private String flowTrace;

    @Comment("中断原因")
    private String brokenReason;

    @Comment("异常名称")
    @ColumnType("text")
    private String exceptionMessage;

    @Comment("流程异常信息")
    @ColumnType("text")
    private String exception;

    @Comment("启动时间")
    private LocalDateTime startTime;

    @Comment("结束时间")
    private LocalDateTime endTime;

    @Comment("耗时-毫秒")
    private Long consumeTime;

    @Comment("流程状态(0:无法判断,1:正常结束,2:抛出异常,3:流程中断)")
    private Integer status;

    @TableField(createdAt = true)
    private LocalDateTime createdAt;

    @TableField(updatedAt = true)
    private LocalDateTime updatedAt;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Long getFlowId() {
        return flowId;
    }

    public void setFlowId(Long flowId) {
        this.flowId = flowId;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public JSONObject getRequestData() {
        return requestData;
    }

    public void setRequestData(JSONObject requestData) {
        this.requestData = requestData;
    }

    public JSONObject getContextData() {
        return contextData;
    }

    public void setContextData(JSONObject contextData) {
        this.contextData = contextData;
    }

    public JSONObject getQuickFlowData() {
        return quickFlowData;
    }

    public void setQuickFlowData(JSONObject quickFlowData) {
        this.quickFlowData = quickFlowData;
    }

    public JSONObject getFlowConfigData() {
        return flowConfigData;
    }

    public void setFlowConfigData(JSONObject flowConfigData) {
        this.flowConfigData = flowConfigData;
    }

    public String getSql() {
        return sql;
    }

    public void setSql(String sql) {
        this.sql = sql;
    }

    public String getFlowNameList() {
        return flowNameList;
    }

    public void setFlowNameList(String flowNameList) {
        this.flowNameList = flowNameList;
    }

    public String getFlowTrace() {
        return flowTrace;
    }

    public void setFlowTrace(String flowTrace) {
        this.flowTrace = flowTrace;
    }

    public String getBrokenReason() {
        return brokenReason;
    }

    public void setBrokenReason(String brokenReason) {
        this.brokenReason = brokenReason;
    }

    public String getExceptionMessage() {
        return exceptionMessage;
    }

    public void setExceptionMessage(String exceptionMessage) {
        this.exceptionMessage = exceptionMessage;
    }

    public String getException() {
        return exception;
    }

    public void setException(String exception) {
        this.exception = exception;
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    public Long getConsumeTime() {
        return consumeTime;
    }

    public void setConsumeTime(Long consumeTime) {
        this.consumeTime = consumeTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }
}
